home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 September
/
PCWorld_2006-09_cd.bin
/
v cisle
/
hexer
/
mpth_17.exe
/
{app}
/
scripts
/
Split File.mps
< prev
next >
Wrap
Text File
|
2005-05-22
|
1KB
|
52 lines
INCLUDE '*.lng'
option undo,0
number_radix = 16
number_prefix = ''
number_suffix = ''
= split a file into different pieces
option globalvars, 1
var bytesperpart dword, fname text, nameloop word
var curfn text, filein file, filedat file, filetemp file
var data text sum dword blocks dword rest dword fsize dword
@@start
filein = fileopen('::current')
fsize = filesize(filein)
bytesperpart = dword(input(__SF1__,__SF2__, '65536'))
fname = asksavefilename(__SF3__):= get part name (apppend .01, .02...)
filedat = fileopen(fname+'.dat','c')
nameloop = 1
sum = filesize(filein)
blocks = sum / bytesperpart
rest = sum mod bytesperpart
loop writeblockfile blocks
if rest != 0
bytesperpart = rest
call writeblockfile
endif
fileclose filedat
fileclose filein
showprogress 100
end
@@writeblockfile
fileread filein data bytesperpart
showprogress fsize, filepos(filein)
curfn=fname+'.'+text(nameloop)
filetemp = fileopen(curfn, 'c')
filewrite filetemp data
fileclose filetemp
filewrite filedat (ExtractName(curfn) + "\n")
inc nameloop 1
return